
$(function(){
    // 初始化
    console.log('初始化')
})
let timeid = 0;
let cData = null;
function inittm(){
    let tmnum = $("#tm_num").val();
    let tmtime = $("#tm_time").val();
    $.get("/ks/inittm",{tmnum:tmnum,tmtime:tmtime},function(data){
        console.log(data);
        cData = data;
        initPage()
    })
    clearInterval(timeid);
    timeid = setInterval(updataStatus,1000)
}

function updataStatus(){
    console.log("time")
    console.log(cData)
}
function initPage(){
    let pDiv = $("#text_div").html("");
    if(cData!=null){
        for(let i=0;i<cData.kstms.length;i++){
            let o = cData.kstms[i]
            let html = "<div class=\"edim_div\">"
            html+="<span class='edit_tm'>"+o.tm+"(    )</span>";
            html+="<div class='edit_select_da'>"
            for(let j=0;j<o.select.length;j++){
                let selected = o.select[j]
                html+="<label><input type='checkbox' name='' onclick='' value='1' />"+selected+"</label>&ensp;&ensp;"
            }
            html+="</div>"
            html+="</div>";
            pDiv.append(html)
        }
    }
}